﻿using LVYAN.Model;
using LVYAN.Utils;
using System.Collections.Generic;

namespace LVYAN.Service.AIAPI
{
    /// <summary>
    /// 
    /// </summary>
    public class WaitSecondManage : BaseAPI
    {
        /// <summary>
        /// 无消息气泡时的查询时间
        /// </summary>
        /// <returns></returns>
        public static List<WaitSecondModel> GetWaitSecondList(string RobotId)
        {
            var Cache = new AIConfig().GetConfigModel(nameof(WaitSecondManage), nameof(GetWaitSecondList)).Cache;

            var content = JsonService.ToString(new { RobotId });
            var Result = CacheManage<List<WaitSecondModel>>.GetCache(content, () =>
            {
                new LoggerService().ResponseMsgDebug("气泡响应管理", "无消息气泡时的查询时间", content);
                var result = new RequestService().PostJson($"{AIAPI}api/aichat/GetWaitSecondList", content);
                if (string.IsNullOrWhiteSpace(result)) return default;
                var model = JsonService.ToModel<ReponseData<List<WaitSecondModel>>>(result);
                new LoggerService().ResponseMsgDebug("气泡响应管理", "无消息气泡时的查询时间", model);
                return model.Data;
            }, Cache);
            return Result;
        }
    }
}
